package blackithei.TCP;

import java.io.*;
import java.net.Socket;

public class ClientDemo4 {
    public static void main(String[] args) throws IOException {
        Socket so=new Socket("127.0.1",10001);


            //本地流  读数据
            BufferedInputStream bf=new BufferedInputStream(new FileInputStream("day15\\aaa"));
            //网络流  写数据
            BufferedOutputStream buf=new BufferedOutputStream(so.getOutputStream());
            int by;
            while((by=bf.read())!=-1){
                buf.write(by);
            }
            so.shutdownOutput();

            //接收反馈
            BufferedReader br=new BufferedReader(new InputStreamReader(so.getInputStream()));
            String line;
            while((line=br.readLine())!=null){
                System.out.println(line);
            }
            br.close();
            bf.close();

        //so.close();
    }
}
